import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"

import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
import DefineOptions from "unplugin-vue-define-options/vite"

import { resolve } from "path"

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    DefineOptions(),
      // setup中给组件添加name： defineOptions({name: "hahaa"})
    Components({
      resolvers: [AntDesignVueResolver({ importStyle: false })],
      // 添加{ importStyle: false } 解决切换主题之后primary-color这些颜色又被替代的问题
    }),
  ],
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    },
    extensions: [".ts", ".tsx", ".js", ".vue"]
  },
  server: {
    host: "0.0.0.0"
  },
})
